/**
 * 
 */
package ee.logsimulator.data;

/**
 * @author Romet Piho
 * 
 */
public class Spell {

  private String name;

  public Spell(String name) {
    this.name = name;
  }

  public String getName() {
    if (isWhiteAttack()) {
      return "Melee";
    }
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public boolean isWhiteAttack() {
    return name.equals("hits") || name.equals("crits");
  }

  @Override
  public boolean equals(Object obj) {
    if (obj instanceof Spell) {
      return getName().equals(((Spell) obj).getName());
    }
    return false;
  }

  @Override
  public int hashCode() {
    return getName().hashCode();
  }

  @Override
  public String toString() {
    return getName();
  }
}
